<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateSystemAnnexTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('system_annex', function (Blueprint $table) {
            $table->increments('id')->comment('ID');
            $table->string('driver',30)->nullable()->default(null)->comment('存储设备');
            $table->string('original_name',200)->nullable()->comment('文件原名');
            $table->integer('file_size')->default(0)->comment('文件大小');
            $table->string('file_ext',30)->nullable()->comment('文件后缀');
            $table->char('url',60)->comment('文件地址');
            $table->string('mime_type',13)->comment('文件类型');
            $table->integer('group_id')->default(0)->comment('组id');
            $table->dateTime('created_at')->nullable()->comment('创建时间');
            $table->index('group_id','group_id');
            $table->index('original_name','original_name');
            $table->comment('系统附件表');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('system_annex', function (Blueprint $table) {
            //
        });
    }
}
